#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by master on 2017/3/11

import paramiko

private_key = paramiko.RSAKey.from_private_key_file("key_path")

transport = paramiko.Transport(("hostname", 22))

transport.connect(username="username", pkey=private_key)

sftp = paramiko.SFTPClient.from_transport(transport)

sftp.put("local_file_path", "destination_path")

sftp.get("remote_path", "local")

transport.close()
